package controllers;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import models.Organization;



public class OrderOrgByViews implements Comparator<Organization> {

	@Override
	public int compare(Organization u1, Organization u2) {
		if(u1.numberOfView < u2.numberOfView)
			return -1;
		if(u1.numberOfView > u2.numberOfView)
			return 1;
		return 0;
	}


	public static void sort(ArrayList<Organization> orgs){
		Collections.sort(orgs, new OrderOrgByViews());
	}

}
